home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / April 96 / Promises, Promises < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.2 KB  |  [TEXT/ttxt]

  1. Subject:     Promises, Promises
  2. Sent:        3/29/96 5:02 PM
  3. Received:    3/29/96 4:11 PM
  4. From:        Nolan Larsen, nlarsen@itsnet.com
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. ODF Team,
  9. ODF places a promise on the clipboard when a selection object is cut or
  10. copied to the clipboard. This does not work for text. Let me give you an
  11. example:
  12.  
  13. When a paragraph of text is selected to be cut or copied and the cut or
  14. copy command is issued, the following method in FWSelect.cpp is called:
  15.  
  16.  
  17. void FW_CSelection::PrivHandleExternalizeSelection(Environment* ev,
  18.  
  19. FW_EStorageKinds storageKind,
  20.  
  21. ODStorageUnit* destinationSU,
  22.  
  23. FW_CCloneInfo* cloneInfo)
  24. {
  25.         // ----- Add the needed properties first -----
  26.         GetPart(ev)->AddProperties(ev, destinationSU);
  27.  
  28.         ODUpdateID updateID = 0;
  29.  
  30.         GetPart(ev)->DeletePromise(ev, storageKind);
  31.  
  32.         if (storageKind == FW_kClipboardStorage)
  33.                 updateID = GetSession(ev)->GetClipboard(ev)->GetUpdateID(ev);
  34.  
  35.         FW_CPromise* promise = NewPromise(ev, updateID, storageKind,
  36.  
  37. cloneInfo->GetScopeFrame(ev),
  38.  
  39. cloneInfo->GetCloneKind(ev));
  40.  
  41.         if (promise)
  42.         {
  43.                 GetPart(ev)->SetPromise(ev, promise);
  44.                 promise->PromisePropertiesAndValues(ev, destinationSU);
  45.         }
  46.         else
  47.         {
  48.                 this->DoExternalizeSelection(ev, destinationSU, cloneInfo);
  49.         }
  50.  
  51.  
  52. I have overwritten the DoExternalizeSelection method to externalize the
  53. selected paragraph but my method is not called in response to the cut or
  54. copy command, instead a promise is written to the clipboard.
  55.  
  56. Now the user repositions the insertion point to another location in the
  57. document and selects the paste command. At this point my
  58. DoExternalizeSelection method is called to fulfill the promise. The only
  59. problem is that the promised selection is lost when the user repositioned
  60. the cursor and there is no way for me to fulfill the promise.
  61.  
  62. How can I get ODF to call my method directly when cut or copy is invoked
  63. rather than writing a promise to the clipboard?
  64.  
  65. BTW, Why are there hard coded interface strings in the DoIt method of
  66. FWEdCmd.cpp?
  67.  
  68. Thanks,
  69. Nolan Larsen
  70. nlarsen@itsnet.com
  71.  
  72.